import React, { lazy } from 'react'

//  主页
const Main = lazy(() => import('../pages/Main'))

const Home = lazy(() => import('../pages/Home'))
const Special = lazy(() => import('../pages/Special'))
const Classify = lazy(() => import('../pages/Classify'))
const ShopCar = lazy(() => import('../pages/ShopCar'))
const My = lazy(() => import('../pages/My'))
const Detail = lazy(() => import('../pages/Detail'))
const Login = lazy(() => import('../pages/Login'))

const Err404 = lazy(() => import('../pages/ErrPage/404'))


export const footerList = [
    {
        path: '/main/home',
        element: <Home/>,
        title: '首页'
    },{
        path: '/main/special',
        element: <Special/>,
        title: '专题'
    },{
        path: '/main/classify',
        element: <Classify/>,
        title: '分类'
    },{
        path: '/main/shopCar',
        element: <ShopCar/>,
        title: '购物车'
    },{
        path: '/main/my',
        element: <My/>,
        title: '我的'
    }
]

const routes = [
    {
        path:'/main',
        element: <Main/>,
        children: footerList
    },{
        path: '/404',
        element: <Err404/>
    },
    {
        path: '/detail/:id',
        element: <Detail/>
    },
    {
        path: '/login',
        element: <Login/>
    },
    {
        from :'/',
        to: '/main/home'
    }
]


export default routes
